package tcu.iot.gasmanage.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import tcu.iot.gasmanage.entity.user.User;

@Repository
@Mapper
@Component("UserMapper")
public interface UserMapper {
    @Select("SELECT * FROM user WHERE username = #{username} " + " AND password = #{password}")
    User LoginUser(@Param("username") String username,
                   @Param("password") String password);

    @Select("SELECT * FROM user WHERE username = #{username} AND password = #{password}")
    boolean FindPassword(@Param("username") String username,
                         @Param("password") String password);

    @Update("UPDATE user SET password=#{password} WHERE username = #{username}")
    boolean UpdatePassword(@Param("username") String username,
                           @Param("password") String password);
}
